/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.controlcobros.dao;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.itschapala.dsw2.controlcobros.modelo.Documentacion;

/**
 *
 * @author Maricela
 */
@Stateless
public class DocumentacionDao extends AbstractDao<Documentacion> implements DocumentacionDaoLocal {
    @PersistenceContext(unitName = "ControlDeCobros8A-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public DocumentacionDao() {
        super(Documentacion.class);
    }
    
     @Override
    public boolean findByIdUsuario (Documentacion documentation){
     Query q = em.createNamedQuery("Documentacion.findByIdUsuario");
        q.setParameter("idUsuario", documentation.getIdUsuario());
     return !q.getResultList().isEmpty();
    }
    
}
